import 'package:flutter/cupertino.dart';
import 'package:full_display/generated/l10n.dart';

class DrawerProvider extends ChangeNotifier {
  final List playModelList = [
    {"title": S.current.sequence_play, "isSelect": false},
    {"title": S.current.random_play, "isSelect": false},
    {"title": S.current.single_play, "isSelect": false},
  ];
  final List colorList = [
    {"title": S.current.cool_color, "isSelect": true},
    {"title": S.current.warm_color, "isSelect": false},
    // {"title": "高亮", "isSelect": false},
    {"title": S.current.true_color, "isSelect": false},
  ];
  final List runModelList = [
    {"title": S.current.tongdianzhuan, "isSelect": true},
    {"title": S.current.tongdianbuzhuan, "isSelect": false},
    {"title": S.current.jiyiqiting, "isSelect": false},
  ];
  final List deviceFunList = [
    {"title": S.current.shebeixinxi, "img": 'icon_device_info'},
    {"title": S.current.chongqi, "img": 'icon_device_replay'},
    {"title": S.current.test_led, "img": 'icon_side_light'},
    {"title": S.current.exit_test_led, "img": 'icon_device_exit'},
    {"title": S.current.aging_mode, "img": 'icon_ aging_model'},
  ];
  //初始化状态
  initState(Map map) {
    var playModel = map['properties']['play_mode'];
    switch (playModel) {
      case 1:
        changePlayState(0);
        break;
      case 2:
        changePlayState(2);
        break;
      case 3:
        changePlayState(1);
        break;
      default:
    }
  }

//改变色温模式
  changeColorState(int index) {
    colorList.forEach((element) {
      element['isSelect'] = false;
    });
    colorList[index]['isSelect'] = true;
    notifyListeners();
  }

  //改变播放模式当前状态
  changePlayState(int index) {
    playModelList.forEach((element) {
      element['isSelect'] = false;
    });
    playModelList[index]['isSelect'] = true;
    notifyListeners();
  }

  //改变电机当前状态
  changeRunState(int index) {
    runModelList.forEach((element) {
      element['isSelect'] = false;
    });
    runModelList[index]['isSelect'] = true;
    notifyListeners();
  }
}
